﻿using DevExpress.XtraEditors.Repository;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.BandedGrid;
using DevExpress.XtraGrid.Views.Base;
using SMALLERP.DataClass;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace XJLSC.FM
{
    public partial class MLFX : Form
    {
        private readonly DataBase db = new DataBase();
        private SqlDataReader sdr1;
        public MLFX()
        {
            InitializeComponent();
            InitGrid();
        }

        private void InitGrid()

        {



            // advBandedGridView1是表格上的默认视图，注意这里声明的是：BandedGridView

            //BandedGridView view = advBandedGridView1 as BandedGridView;



            //view.BeginUpdate(); //开始视图的编辑，防止触发其他事件

            //view.BeginDataUpdate(); //开始数据的编辑



            //view.Bands.Clear();



            ////修改附加选项

            //view.OptionsView.ShowColumnHeaders = false;                         //因为有Band列了，所以把ColumnHeader隐藏

            //view.OptionsView.ShowGroupPanel = false;                            //如果没必要分组，就把它去掉

            //view.OptionsView.EnableAppearanceEvenRow = false;                   //是否启用偶数行外观

            //view.OptionsView.EnableAppearanceOddRow = true;                     //是否启用奇数行外观

            //view.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.Never;   //是否显示过滤面板

            //view.OptionsCustomization.AllowColumnMoving = false;                //是否允许移动列

            //view.OptionsCustomization.AllowColumnResizing = false;              //是否允许调整列宽

            //view.OptionsCustomization.AllowGroup = false;                       //是否允许分组

            //view.OptionsCustomization.AllowFilter = false;                      //是否允许过滤

            //view.OptionsCustomization.AllowSort = true;                         //是否允许排序

            //view.OptionsSelection.EnableAppearanceFocusedCell = true;           //是否焦点显示选中的单元格

            //view.OptionsBehavior.Editable = false;                             //是否允许用户编辑单元格



            //添加列标题

            //GridBand bandID = view.Bands.AddBand("ID");

            //bandID.Visible = false; //隐藏ID列

            //GridBand bandTD001 = view.Bands.AddBand("订单单别");
            //GridBand bandTD002 = view.Bands.AddBand("订单单号");
            //GridBand bandTD003 = view.Bands.AddBand("订单序号");
            //GridBand bandTH001 = view.Bands.AddBand("销货单别");
            //GridBand bandTH002 = view.Bands.AddBand("销货单号");
            //GridBand bandTH003 = view.Bands.AddBand("销货序号");
            //GridBand bandTH004 = view.Bands.AddBand("品号");
            //GridBand bandTH005 = view.Bands.AddBand("品名");
            //GridBand bandTH006 = view.Bands.AddBand("规格");
            //GridBand bandTH008 = view.Bands.AddBand("销货数量");
            //GridBand bandTH012 = view.Bands.AddBand("销售单价");
            //GridBand bandSJCB = view.Bands.AddBand("实际成本");
            //GridBand bandLA012 = bandSJCB.Children.AddBand("单价");
            //GridBand bandLA017 = bandSJCB.Children.AddBand("材料");
            //GridBand bandLA018 = bandSJCB.Children.AddBand("人工");
            //GridBand bandLA019 = bandSJCB.Children.AddBand("制费");
            //GridBand bandLA020 = bandSJCB.Children.AddBand("加工费");
            //GridBand bandMLV = view.Bands.AddBand("毛利率");

            ////GridBand bandSubTotal = bandSJCB.Children.AddBand("小计");

            //GridBand bandBZCB = view.Bands.AddBand("标准成本");
            //GridBand bandBZTotal = bandBZCB.Children.AddBand("单价");
            //GridBand bandMB057 = bandBZCB.Children.AddBand("材料");
            //GridBand bandMB058 = bandBZCB.Children.AddBand("人工");
            //GridBand bandMB059 = bandBZCB.Children.AddBand("制费");
            //GridBand bandMB060 = bandBZCB.Children.AddBand("加工费");
            //GridBand bandRemark = view.Bands.AddBand("备注");



            //列标题对齐方式

            //bandTD001.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTD002.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTD003.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH001.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH002.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH003.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH004.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH005.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH006.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH008.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandTH012.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandSJCB.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandLA012.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandLA017.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandLA018.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandLA019.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandLA020.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandMLV.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandBZCB.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandBZTotal.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandMB057.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandMB058.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandMB059.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandMB060.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
            //bandRemark.AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;


            //[小计]这一列因为没绑定数据源，所以需要手动添加

            //(有点复杂，慢慢看吧)

            //string[] fieldNames = new string[] { "BZTotal" };

            //GridColumn column;   //声明单列

            //column = view.Columns.AddField(fieldNames[0]);  //添加一个数据字段

            //column.VisibleIndex = view.Columns.Count - 1;  //设置该列在编辑视图时的显示位置(倒数第二列) 

            //column.UnboundType = DevExpress.Data.UnboundColumnType.Decimal;

            //column.OptionsColumn.AllowEdit = false;     //此列不可编辑

            //column.Visible = true;

            //view.Columns.Add(column);   //视图中添加一列



            //绑定事件，当[分数]改变时[小计]也跟着变

            //(好像只有在绑定事件里才能改变该单元格数值，直接修改无效)

            //view.CustomUnboundColumnData += new

            //    DevExpress.XtraGrid.Views.Base.CustomColumnDataEventHandler(advBandedGridView1_CustomUnboundColumnData);



            ////[性别]列绑定ComboBox

            //RepositoryItemComboBox riCombo = new RepositoryItemComboBox();

            //riCombo.Items.AddRange(new string[] { "男", "女" });

            //gridControl1.RepositoryItems.Add(riCombo);

            //view.Columns["Sex"].ColumnEdit = riCombo;



            ////[出生年月]列绑定Date

            //RepositoryItemDateEdit riDate = new RepositoryItemDateEdit();

            //gridControl1.RepositoryItems.Add(riDate);

            //view.Columns["Birth"].ColumnEdit = riDate;



            ////[分数]列绑定SpinEdit

            //RepositoryItemSpinEdit riSpin = new RepositoryItemSpinEdit();

            //gridControl1.RepositoryItems.Add(riSpin);

            //view.Columns["Math"].ColumnEdit = riSpin;

            //view.Columns["Chinese"].ColumnEdit = riSpin;

            //view.Columns["English"].ColumnEdit = riSpin;



            ////[备注]列绑定MemoExEdit

            //RepositoryItemMemoExEdit riMemoEx = new RepositoryItemMemoExEdit();

            //gridControl1.RepositoryItems.Add(riMemoEx);

            //view.Columns["Remark"].ColumnEdit = riMemoEx;





            //小计列添加汇总

            //view.OptionsView.ShowFooter = true;     //显示表格页脚

            //view.Columns["BZTotal"].SummaryItem.FieldName = "SubTotal";

            //view.Columns["BZTotal"].SummaryItem.DisplayFormat = "{0:f2}";

            //view.Columns["BZTotal"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Average;



            //将标题列和数据列对应
            //view.Columns["TD001"].OwnerBand = bandTD001;
            //view.Columns["TD002"].OwnerBand = bandTD002;
            //view.Columns["TD003"].OwnerBand = bandTD003;
            //view.Columns["TH001"].OwnerBand = bandTH001;
            //view.Columns["TH002"].OwnerBand = bandTH002;
            //view.Columns["TH003"].OwnerBand = bandTH003;
            //view.Columns["TH004"].OwnerBand = bandTH004;
            //view.Columns["TH005"].OwnerBand = bandTH005;
            //view.Columns["TH006"].OwnerBand = bandTH006;
            //view.Columns["TH008"].OwnerBand = bandTH008;
            //view.Columns["TH012"].OwnerBand = bandTH012;
            //view.Columns["LA012"].OwnerBand = bandLA012;
            //view.Columns["LA017"].OwnerBand = bandLA017;
            //view.Columns["LA018"].OwnerBand = bandLA018;
            //view.Columns["LA019"].OwnerBand = bandLA019;
            //view.Columns["LA020"].OwnerBand = bandLA020;
            //view.Columns["MLV"].OwnerBand = bandMLV;
            //view.Columns["BZDJ"].OwnerBand = bandBZTotal;
            //view.Columns["MB057"].OwnerBand = bandMB057;
            //view.Columns["MB058"].OwnerBand = bandMB058;
            //view.Columns["MB059"].OwnerBand = bandMB059;
            //view.Columns["MB060"].OwnerBand = bandMB060;
            //view.Columns["Remark"].OwnerBand = bandRemark;
            //view.EndDataUpdate();//结束数据的编辑
            //view.EndUpdate();   //结束视图的编辑
        }

        // 计算小计

        //private float calcSubTotal(float math, float chinese, float english)

        //{
        //    return math + chinese + english;
        //}





        //private void advBandedGridView1_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)

        //{

        //    ColumnView colView = sender as ColumnView;

        //    if (e.Column.FieldName == "SubTotal" && e.IsGetData) e.Value = calcSubTotal(

        //             Convert.ToSingle(colView.GetRowCellValue(e.RowHandle, colView.Columns["Math"])),

        //             Convert.ToSingle(colView.GetRowCellValue(e.RowHandle, colView.Columns["Chinese"])),

        //             Convert.ToSingle(colView.GetRowCellValue(e.RowHandle, colView.Columns["English"])));

        //}

        private void MLFX_Load(object sender, EventArgs e)
        {
            tabPage2.Parent = null;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            String strSql = "";
            strSql = "SELECT RIGHT('0000'+RTRIM(CAST(ROW_NUMBER()OVER(ORDER BY B.RECEIVABLE_DOC_ID) AS CHAR(40))),40) 序号,C.COMPANY_NAME 销售主体,D.CUSTOMER_CODE 客户编号,D.CUSTOMER_NAME 客户名称,F.凭证日期,F.凭证单号,CONVERT(CHAR(8),B.DOC_DATE,112) 发票日期,ISNULL(E.TAX_INVOICE_NO,'') 发票号,B.TAX_RATE 税率,B.DOC_NO 应收单号,G.DOC_NO 销售出库单号,G.VIEW_DOC_NO 销货单号,I.DOC_NO 销售订单号,ISNULL(M.COMPANY_NAME,'未查到') 生产主体,N.ITEM_CODE 产品品号,N.ITEM_NAME 产品品名,N.ITEM_SPECIFICATION 产品规格,CAST(H.BUSINESS_QTY AS REAL) 销货数量,O.UNIT_NAME 单位,CAST(H.TAX_RATE AS REAL) 增值税税率,P.CURRENCY_NAME 币种,CAST(B.EXCHANGE_RATE AS REAL) 汇率,CAST(ROUND((CASE WHEN H.PRICE_QTY=0 THEN 0 ELSE H.AMOUNT_UNINCLUDE_TAX_OC/H.PRICE_QTY END),2) AS REAL) 原币不含税单价,CAST(H.AMOUNT_UNINCLUDE_TAX_OC AS REAL) 原币未税金额,CAST(H.TAX_OC AS REAL) 原币税额,CAST(H.AMOUNT AS REAL) 原币含税金额,CAST(ROUND((CASE WHEN H.PRICE_QTY=0 THEN 0 ELSE H.AMOUNT_UNINCLUDE_TAX_BC/H.PRICE_QTY END),2) AS REAL) 本币不含税单价,CAST(H.AMOUNT_UNINCLUDE_TAX_BC AS REAL) 本币未税金额,CAST(H.TAX_BC AS REAL) 本币税额,CAST(H.AMOUNT*B.EXCHANGE_RATE AS REAL) 本币含税金额,CAST(Q.UNIT_COST AS REAL) 本币销货成本,CAST(ISNULL(R.UNIT_COST,0) AS REAL) 穿透销货成本,";
            strSql += "CAST(ISNULL((SELECT SUM(COST_AMT) FROM TRANS_LINE_COST_DETAIL A LEFT JOIN COST_ELEMENT B ON A.COST_ELEMENT_ID = B.COST_ELEMENT_ID WHERE B.COST_ELEMENT_CATEGORY = '1' AND R.TRANSACTION_LINE_ID = A.TRANSACTION_LINE_ID), 0) AS REAL) 穿透材料成本,";
            strSql += "CAST(ISNULL((SELECT SUM(COST_AMT) FROM TRANS_LINE_COST_DETAIL A LEFT JOIN COST_ELEMENT B ON A.COST_ELEMENT_ID = B.COST_ELEMENT_ID WHERE B.COST_ELEMENT_CATEGORY = '2' AND R.TRANSACTION_LINE_ID = A.TRANSACTION_LINE_ID), 0) AS REAL) 穿透人工成本,";
            strSql += "CAST(ISNULL((SELECT SUM(COST_AMT) FROM TRANS_LINE_COST_DETAIL A LEFT JOIN COST_ELEMENT B ON A.COST_ELEMENT_ID = B.COST_ELEMENT_ID WHERE B.COST_ELEMENT_CATEGORY = '3' AND R.TRANSACTION_LINE_ID = A.TRANSACTION_LINE_ID), 0) AS REAL) 穿透制费成本,";
            strSql += "CAST(ISNULL((SELECT SUM(COST_AMT) FROM TRANS_LINE_COST_DETAIL A LEFT JOIN COST_ELEMENT B ON A.COST_ELEMENT_ID = B.COST_ELEMENT_ID WHERE B.COST_ELEMENT_CATEGORY = '4' AND R.TRANSACTION_LINE_ID = A.TRANSACTION_LINE_ID), 0) AS REAL) 穿透其他成本";
            strSql += " FROM RECEIVABLE_DOC_D A LEFT JOIN RECEIVABLE_DOC B ON A.RECEIVABLE_DOC_ID = B.RECEIVABLE_DOC_ID LEFT JOIN COMPANY C ON C.COMPANY_ID = B.Owner_Org_ROid LEFT JOIN CUSTOMER D ON D.CUSTOMER_BUSINESS_ID = B.ORDER_CUSTOMER_ID LEFT JOIN RECEIVABLE_DOC_TAXINV E ON E.RECEIVABLE_DOC_ID = B.RECEIVABLE_DOC_ID";
            strSql += " LEFT JOIN(SELECT DISTINCT TRANS_DOC_NO, C.VOUCHER_NO 凭证单号, CONVERT(CHAR(8),C.BOOKKEEPING_DATE,112) 凭证日期 FROM JOURNAL_ENTRY_D A LEFT JOIN JOURNAL_ENTRY B ON A.JOURNAL_ENTRY_ID = B.JOURNAL_ENTRY_ID LEFT JOIN VOUCHER C ON C.VOUCHER_ID = B.VOUCHER_ID WHERE AJS_TYPE=1) F ON F.TRANS_DOC_NO = B.DOC_NO";
            strSql += " LEFT JOIN SALES_ISSUE G ON A.SOURCE_ID_ROid = G.SALES_ISSUE_ID";
            strSql += " LEFT JOIN SALES_ISSUE_D H ON A.SOURCE2_ID_ROid = H.SALES_ISSUE_D_ID LEFT JOIN SALES_ORDER_DOC_SD J ON H.ORDER_SOURCE_ID_ROid = J.SALES_ORDER_DOC_SD_ID LEFT JOIN SALES_ORDER_DOC_D K ON J.SALES_ORDER_DOC_D_ID = K.SALES_ORDER_DOC_D_ID LEFT JOIN SALES_ORDER_DOC I ON I.SALES_ORDER_DOC_ID = K.SALES_ORDER_DOC_ID";
            strSql += " LEFT JOIN MO_RECEIPT_D L ON L.ITEM_ID = H.ITEM_ID AND L.ITEM_LOT_ID = H.ITEM_LOT_ID";
            strSql += " LEFT JOIN COMPANY M ON M.COMPANY_ID = L.COST_DOMAIN_ID_ROid";
            strSql += " LEFT JOIN ITEM N ON N.ITEM_BUSINESS_ID = H.ITEM_ID LEFT JOIN UNIT O ON O.UNIT_ID = H.BUSINESS_UNIT_ID";
            strSql += " LEFT JOIN CURRENCY P ON P.CURRENCY_ID = B.CURRENCY_ID";
            strSql += " LEFT JOIN TRANSACTION_LINE Q ON Q.SOURCE_ID_ROid = H.SALES_ISSUE_D_ID";
            strSql += " LEFT JOIN TRANSACTION_LINE R ON R.SOURCE_ID_ROid = L.MO_RECEIPT_D_ID WHERE  CONVERT(CHAR(8),B.DOC_DATE,112)>=CONVERT(CHAR(8),DATEADD(DAY,0,'" + dateTimePicker1.Value.ToShortDateString() + "'),112)  AND  CONVERT(CHAR(8),B.DOC_DATE,112)<=CONVERT(CHAR(8),DATEADD(DAY,0,'" + dateTimePicker2.Value.ToShortDateString() + "'),112)";
           
            try
            {
                DataTable dt;
                dt = db.GetDataSet1(strSql, "PURTD").Tables["PURTD"];
                gridControl1.DataSource = dt;
            }
            catch
            {

            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            SaveFileDialog fileDialog = new SaveFileDialog();
            fileDialog.Title = "导出Excel";
            fileDialog.Filter = "Excel文件(*.xls)|*.xls";
            DialogResult dialogResult = fileDialog.ShowDialog(this);
            if (dialogResult == DialogResult.OK)
            {
                DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();
                gridControl1.ExportToXls(fileDialog.FileName);
                DevExpress.XtraEditors.XtraMessageBox.Show("保存成功！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //int[] rownumber = this.advBandedGridView1.GetSelectedRows();
            //if (rownumber.Length < 1)
            //    return;
            //for (int i = 0; i < rownumber.Length; i++)
            //{
            //    string Item = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "TH004").ToString();
            //    string cldj = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "LA017").ToString();
            //    string rgdj = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "LA018").ToString();
            //    //string ComputerName = Dns.GetHostName();
            //    string zfdj = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "LA019").ToString();
            //    string jgdj = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "LA020").ToString();
            //    string xhdb = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "TH001").ToString();
            //    string xhdh = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "TH002").ToString();
            //    string xhxh = this.advBandedGridView1.GetRowCellValue(this.advBandedGridView1.GetSelectedRows()[i], "TH003").ToString();


            //    string strSql = @"UPDATE INVMB SET MB057 = " + cldj + ",MB058 = " + rgdj + ",MB059 = " + zfdj + ",MB060 = " + jgdj + " WHERE MB001 = '" + Item + "'";

            //    try
            //    {
            //        if (db.ExecDataBySql1(strSql) > 0)
            //        {
            //        }
            //        else
            //        {
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "软件提示");
            //        throw ex;
            //    }

            //    strSql = @"DELETE FROM ACMMJ WHERE MJ001='2' AND MJ002='" + Item + "'";
            //    try
            //    {
            //        if (db.ExecDataBySql1(strSql) > 0)
            //        {
            //        }
            //        else
            //        {
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "软件提示");
            //        throw ex;
            //    }

            //    strSql = @"INSERT INTO ACMMJ(COMPANY,CREATOR,USR_GROUP,CREATE_DATE,MODIFIER,MODI_DATE,FLAG,MJ001,MJ002,MJ003,MJ004,MJ005,MJ006,MJ007,MJ008,MJ009,MJ010,MJ011,MJ012,MJ013,MJ014,UDF01,UDF02,UDF03,UDF04,UDF05,UDF06,UDF51,UDF52,UDF53,UDF54,UDF55,UDF56,UDF07,UDF08,UDF09,UDF10,UDF11,UDF12,UDF57,UDF58,UDF59,UDF60,UDF61,UDF62) SELECT A.COMPANY,A.CREATOR,A.USR_GROUP,A.CREATE_DATE,A.MODIFIER,A.MODI_DATE,A.FLAG,'2',LH006,LH007,MJ004,0,CAST(LH008/TH008 AS numeric(17,8)),CAST(LH008/TH008 AS numeric(17,8)),CAST(LH008/TH008/LA012 AS numeric(5,4)),'','','',0,0,0,'','','','','','',0,0,0,0,0,0,'','','','','','',0,0,0,0,0,0 FROM INVLH A LEFT JOIN COPTH ON A.LH002=TH001 AND A.LH003=TH002 AND A.LH004=TH003 LEFT JOIN INVLA ON TH001=LA006 AND TH002=LA007 AND TH003=LA008 LEFT JOIN ACMMJ ON MJ001='1' AND LH006=MJ002 AND LH007=MJ003 WHERE LH002='" + xhdb + "' AND LH003='" + xhdh + "' AND LH004='" + xhxh + "'";
              
            //    try
            //    {
            //        if (db.ExecDataBySql1(strSql) > 0)
            //        {
            //        }
            //        else
            //        {
            //        }
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "软件提示");
            //        throw ex;
            //    }
            //}
            //MessageBox.Show("转换成功！", "软件提示");
        }
    }
}
